<?php
$cycle = $this->db->query_select("cllg_college_cycle");
$career = $this->db->query_select("cllg_career");

?>

<div id="paramCont" style="margin-bottom: 10px">
    <div id="getParams">
        <table width="80%">
            <th colspan="2">
                <legend>Seleccione ciclo y carrera</legend>
            </th>
            <tr>
                <td width="10%">
                    <label for="cycle">CICLO: </label>
                </td>
                <td width="90%">
                    <select name="cycle">
                        <option selected="selected" value="0">--Seleccione ciclo--</option>
                        <?php foreach($cycle as $cy){ ?>
                        <option value="<?php echo $cy['CODE']; ?>"><?php echo $cy['CODE']; ?></option>
                        <?php } ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <label for="career">CARRERA: </label>
                </td>
                <td>
                    <select name="career"   value="0" style="width:300px">
                        <option selected="selected">--Seleccione carrera--</option>
                        <?php foreach($career as $c){ ?>
                        <option value="<?php echo $c['ID']; ?>"><?php echo $c['NAME']; ?></option>
                        <?php } ?>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    
    <div id="getFields">
        <table width="80%" border="0" cellspacing="0" cellpadding="2">
            <tr>
                <th colspan="10">
                    <legend>Seleccione los campos a mostrar </legend>
                </th>
            </tr>
            <tr>
                <th colspan="10" >
                    <span  style="float: left" class="badge badge-info">DATOS GENERALES</span>
                </th>
            </tr>
            <tr>
                <td>
                    <input type='checkbox' value='AIU_CODE' name='baseFields[]' id='AIU_CODE' />
                </td>
                <td>
                    <label for='AIU_CODE'>AIU CODE</label>
                </td>
                <td>
                    <input type='checkbox' value='GENDER' name='baseFields[]' id='GENDER' />
                </td>
                <td>
                    <label for='GENDER'>Género</label>
                </td>
                <td>
                    <input type='checkbox' value='BIRTHDATE' name='baseFields[]' id='BIRTHDATE' />
                </td>
                <td>
                    <label for='BIRTHDATE'>Fecha de nacimiento</label>
                </td>
                <td>
                    <input type='checkbox' value='AGE' name='baseFields[]' id='AGE' />
                </td>
                <td>
                    <label for='AGE'>Edad</label>
                </td>
                <td>
                    <input type='checkbox' value='FK_EMPRESA' name='baseFields[]' id='FK_EMPRESA' />
                </td>
                <td>
                    <label for='FK_EMPRESA'>Empresa</label>
                </td>
            </tr>
            <?php
            $fieldCount = count($this->db->query_select("cllg_tablefield","TABLE_NAME='cllg_student' AND FK_TAB=1"));
            $index = 0;
            while ($fieldCount > $index){ ?>
                <tr>
                    <?php 
                    echo $this->setCol($index,1); 
                    $index += 5;
                    ?>
                </tr>
            <?php
            }
            ?>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <th colspan="10" >
                    <span  style="float: left" class="badge badge-info">ESTUDIOS</span>
                </th>
            </tr>
            <?php
            $fieldCount = count($this->db->query_select("cllg_tablefield","TABLE_NAME='cllg_student' AND FK_TAB=2"));
            $index = 0;
            while ($fieldCount > $index){ ?>
                <tr>
                    <?php 
                    echo $this->setCol($index,2); 
                    $index += 5;
                    ?>
                </tr>
            <?php
            }
            ?>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <th colspan="10" >
                    <span  style="float: left" class="badge badge-info">TRABAJO</span>
                </th>
            </tr>
            <?php
            $fieldCount = count($this->db->query_select("cllg_tablefield","TABLE_NAME='cllg_student' AND FK_TAB=3"));
            $index = 0;
            while ($fieldCount > $index){ ?>
                <tr>
                    <?php 
                    echo $this->setCol($index,3); 
                    $index += 5;
                    ?>
                </tr>
            <?php
            }
            ?>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <th colspan="10" >
                    <span  style="float: left" class="badge badge-info">FACTURACIÓN</span>
                </th>
            </tr>
            <?php
            $fieldCount = count($this->db->query_select("cllg_tablefield","TABLE_NAME='cllg_student' AND FK_TAB=4"));
            $index = 0;
            while ($fieldCount > $index){ ?>
                <tr>
                    <?php 
                    echo $this->setCol($index,4); 
                    $index += 5;
                    ?>
                </tr>
            <?php
            }
            ?>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <th colspan="10" >
                    <span  style="float: left" class="badge badge-info">¿CÓMO SE ENTERÓ?</span>
                </th>
            </tr>
            <tr>
                <td width='2%'>
                    <input type='checkbox' name='comoSeEntero' id='comoSeEntero' />
                </td>
                <td width='18%' style='padding-top:0.3%;padding-bottom:0'><label for='comoSeEntero'>¿Cómo se enteró?</label>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>          
    </div>
    <br/>
    <div id="days">
        <table width="60%">
            <tr>
                <th colspan="12">
                    <legend>Seleccione jornada (opcional)</legend>
                </th>
            </tr>
            <tr>
                <td width="1%" align="left">
                    <input name="LUNES" type="checkbox" id="LUNES" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="LUNES">LUNES</label>
                </td>
                <td width="1%" align="left">
                    <input name="MARTES" type="checkbox" id="MARTES" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="MARTES">MARTES</label>
                </td>       
                <td width="1%" align="left">
                    <input name="MIERCOLES" type="checkbox" id="MIERCOLES" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="MIERCOLES">MIERCOLES</label>
                </td>       
                <td width="1%" align="left">
                    <input name="JUEVES" type="checkbox" id="JUEVES" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="JUEVES">JUEVES</label>
                </td>       
                <td width="1%" align="left">
                    <input name="VIERNES" type="checkbox" id="VIERNES" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="VIERNES">VIERNES</label>
                </td>       
                <td width="1%" align="left">
                    <input name="SABADO" type="checkbox" id="SABADO" value="1" />
                </td>        
                <td width="7%" align="left">
                    <label for="SABADO">SÁBADO</label>
                </td>       
            </tr>
        </table>
    </div>
    <script>
        $("input[type=checkbox]").click(function() {
            var bol = $("input[type=checkbox]:checked").length >= 15;     
            $("input[type=checkbox]").not(":checked").attr("disabled",bol);
        });
    </script>
</div>
<br/>